//李雨飘添加代码：
export let List = [
  { phone: 15258087773, password: 123456, username: "liyupiao" },
  { phone: 11111111111, password: 123456, username: "wuwenhao" },
  { phone: 11111111111, password: 123456, username: "huzhentao" },
  { phone: 11111111111, password: 123456, username: "wangyuchen" },
  { phone: 11111111111, password: 123456, username: "liubao" },
  { phone: 11111111111, password: 123456, username: "miqicheng" },
  { phone: 11111111111, password: 123456, username: "linxiaoye" },
  { phone: 11111111111, password: 123456, username: "shentuyating" },
  { phone: 11111111111, password: 123456, username: "wangjunhao" },
  { phone: 11111111111, password: 123456, username: "wangruijie" },
];
export let ListApply = [];
export default {
  loginData: (config) => {
    let { username, password } = JSON.parse(config.body);
    let token = "";
    let newL = List.find(
      (item) => username == item.username && password == item.password
    );

    // let newUser = ListApply.find((el) => {
    //   username == el.username;
    // });
    // console.log(newUser);
    // console.log(ListApply[0].username + " " + ListApply[0].password);
    // console.log(config.body);
    if (newL && newL.username == "wuwenhao") {
      token = "wuwenhao---wuwenhao";
    } else if (newL && newL.username == "liyupiao") {
      token = "liyupiao---liyupiao";
    } else if (newL && newL.username == "huzhentao") {
      token = "huzhentao---huzhentao";
    } else if (newL && newL.username == "wangyuchen") {
      token = "wangyuchen---wangyuchen";
    } else if (newL && newL.username == "liubao") {
      token = "liubao---liubao";
    } else if (newL && newL.username == "miqicheng") {
      token = "miqicheng---miqicheng";
    } else if (newL && newL.username == "linxiaoye") {
      token = "linxiaoye---linxiaoye";
    } else if (newL && newL.username == "shentuyating") {
      token = "shentuyating---shentuyating";
    } else if (newL && newL.username == "wangjunhao") {
      token = "wangjunhao---wangjunhao";
    } else if (newL && newL.username == "wangruijie") {
      token = "wangruijie---wangruijie";
    } else if (
      ListApply[0].username == username &&
      ListApply[0].password == password &&
      ListApply.length != 0
    ) {
      token = "youke---youke";
    } else {
      return {
        code: 101,
        msg: "密码或用户错误",
        data: null,
      };
    }
    return {
      code: 200,
      msg: "登陆成功",
      data: token,
    };
  },
};
//吴文浩代码。李雨飘暂注释
// export default {
//   loginData: (config) => {
//     let { username, password } = JSON.parse(config.body);
//     let token = "";
//     if (username === "wuwenhao" && password === "123456") {
//       token = "wuwenhao---wuwenhao";
//     } else if (username === "huzhentao" && password === "123456") {
//       token = "huzhentao---huzhentao";
//     } else if (username === "wangyuchen" && password === "123456") {
//       token = "wangyuchen---wangyuchen";
//     } else if (username === "liubao" && password === "123456") {
//       token = "liubao---liubao";
//     } else if (username === "miqicheng" && password === "123456") {
//       token = "miqicheng---miqicheng";
//     } else if (username === "linxiaoye" && password === "123456") {
//       token = "linxiaoye---linxiaoye";
//     } else if (username === "shentuyating" && password === "123456") {
//       token = "shentuyating---shentuyating";
//     } else if (username === "wangjunhao" && password === "123456") {
//       token = "wangjunhao---wangjunhao";
//     } else {
//       return {
//         code: 101,
//         msg: "密码或用户错误",
//         data: null,
//       };
//     }
//     return {
//       code: 200,
//       msg: "登陆成功",
//       data: token,
//     };
//   },
// };
